#include	"app.h"
#include	"kernel.h"
#include	"module.h"
//#include	"global.h"

static TASK_EVENT eMMI_Event = 0;
static INT16U  uwLedFlashCnt;
static INT16U  uw40msCnt;

INT8U  ubFaultCode = 0;
INT16U uwBuzzerCnt;		// 鸣叫计数器
INT16U uwBuzzerCmp;		// 鸣叫长短
INT16U uwBuzzerPeriod;	// 鸣叫周期
INT16U uwBuzzerTimes;	// 鸣叫次数

INT16U uwLedCnt;		// 
INT16U uwLedCmp;		// 
INT16U uwLedPeriod;		// 
INT16U uwLedTimes;		// 


INT8U  ub1sCnt;


union LED_MATRIX1  LedMatrix1[cBtnMax];
union LED_MATRIX2  LedMatrix2[cBtnMax];
union LED_MATRIX1  LedMatrix1Old[cBtnMax];
union LED_MATRIX2  LedMatrix2Old[cBtnMax];


void sGenEventTask(void)
{
	
	while(1)
    {
    	eMMI_Event = OSEventPend();
        
        if(OSEventConfirm(eMMI_Event,eGenEventTimer)) // 4ms
        {        	
			if(++uwLedFlashCnt >= 125) // 500ms
			{
				uwLedFlashCnt = 0;
				OSEventSend(eMMI_Event, eGenTask500ms);
			}

			if(++uw40msCnt >= 10) // 40ms
			{
				uw40msCnt = 0;
				OSEventSend(eMMI_Event, eGen40Ms);
			}
			
        } 

		if(OSEventConfirm(eMMI_Event,eGen40Ms))
        {
			sBtnProcess(); // 主控按键处理
		}

		if(OSEventConfirm(eMMI_Event,eGenTask500ms))
		{

			ub1sCnt++;
			if(ub1sCnt & 0x01)
	        {
				sCupCtr();
				sWaterCtr();
			}
		}
    }
}






